package com.css.zfzx.sjcj.modules.repository;

import com.css.zfzx.sjcj.common.vo.DivisionVo;
import com.css.zfzx.sjcj.modules.pojo.PcStatisticsFillEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.time.LocalDateTime;
import java.util.List;

/**
 * @Description: pc-statistics
 * @Author: lhl
 * @CreateDate: 2021/8/3 10:51
 */
@Repository
public interface PcStatisticsFillRepository extends JpaRepository<PcStatisticsFillEntity,String> {

    @Query(nativeQuery = true,value = "select task_create_time from pc_statistics_fill " +
            "where task_name =:taskName and is_valid='1' order by task_create_time desc limit 1")
    LocalDateTime getCreateTime(String taskName);

    @Query(nativeQuery = true,value = "select task_update_time from pc_statistics_fill " +
            "where task_name =:taskName order by task_update_time desc limit 1")
    LocalDateTime getUpdateTime(String taskName);

    @Query(nativeQuery = true,value = "select * from pc_statistics_fill " +
            "where province =:province and city=:city and area=:area and task_name =:taskName and is_valid='1' limit 1")
    PcStatisticsFillEntity findByDataId(String province,String city,String area,String taskName);

}
